const sql = {
  // 注册
  register: 'insert into user(username, password, phone) values(?, MD5(?), ?)',
  // 登录
  login: 'select id, username, phone from user where phone = ? and password = MD5(?)',
  // 通过id获取用户信息
  getInfoById: 'select * from user where id = ?',
  //获取文章封面
  articles: 'select id, title, image, created_date from article where category = ?',
  // 获取文章详情
  article_detail: 'select title, content, created_date from article where id = ?',
  // 获取医院列表(默认id排序)
  hospital_list: 'select id, name, image, grade, score, distance, address, special_office, tag from hospital order by id asc limit 0, 20',
  // 获取医院列表by grade
  hospital_list_grade: 'select id, name, image, grade, score, distance, address, special_office, tag from hospital where grade = ?',
  // 获取医院列表by distance
  hospital_list_distance: 'select id, name, image, grade, score, distance, address, special_office, tag from hospital order by distance asc',
  // 获取医院列表by score
  hospital_list_score: 'select id, name, grade, image, score, distance, address, special_office, tag from hospital order by score desc',
  //获取医院详情
  hospital_detail: 'select name, distance, address, image, special_office, introduction, opening_time from hospital where id = ?',
  // 进入医院挂号界面
  hospital_registration: 'select id, name, day1, day2, day3, day4, day5, day6, day7 from hospital where id = ?',
  // 病人列表
  patient_list: 'select id, name, relation, id_number, uid from patient where uid = ?',
  // 查询单个病人信息
  single_detail: 'select id, name, id_number from patient where id = ?',
  // 添加病人——用户选择日期进行预约操作,若预约成功，此时需要将hospital里的疫苗库存减1
  add_patient: 'insert into patient set ?',
  // 病人预约疫苗操作
  order_medical: 'insert into appointment(type, name, hid, pid, test_name, appoint_time, state) values(?, ?, ?, ?, ?, ?, ?)',
  // 查看检测报告
  appointment_report: 'select * from appointment where pid = ?',
  // 查看报告详情
  reportdetail: 'select p.name, id_number, a.name as aname, appoint_time, test_name   from patient as p inner join appointment as a on p.id = a.pid where a.pid = ? and a.appoint_time = ?'
}

module.exports = sql